/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2024-07-23
 * Time: 12:40
 */

class Solution{
    public int isDengyu(int[] arr, int val){
        int left = 0;
        int n = arr.length;
        for (int right = 0; right < n ; right++) {
            if(arr[right] != val){
                arr[left] = arr[right];
                left++;
            }
        }
        return left;
    }
}
public class Main {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] arr = {5,8,7,0,9,3,5,6};
        int n = solution.isDengyu(arr,5);
        System.out.println(n);
    }
}
